fix: clean up v2 templates list - #78
Conversation
Honest sequence of events: my first reaction was "fair enough, I'll just delete it from the list — one line, done." But then I got curious. One "wait, why doesn't this work?" led to another. That single comment sent me down a delightful rabbit hole, and I came back with the full picture (plus two working fix approaches). TL;DR (Summary for maintainers)
So, the decisions needed:(a) For the v2 template list(Choose one)
(b) For the SSR fix itself(Choose one)
(c) Independent of (b)Should we also roll in the singleton-to-per-request router fix (as recommended by TanStack Router) described in the "Recommended addition" section?
Two fix approaches (both verified locally)Both approaches produce:
Approach A — Fix the template only (no solid-start changes)Leverage the 2nd Move Diff ( -import { createHandler, FetchEvent, StartServer } from "@solidjs/start/server";
+import { createHandler, StartServer } from "@solidjs/start/server";
import { createMemoryHistory } from "@tanstack/solid-router";
import { router } from "./router";
-const routerLoad = async (event: FetchEvent) => {
- const url = new URL(event.request.url);
- const path = url.href.replace(url.origin, "");
- router.update({
- history: createMemoryHistory({ initialEntries: [path] })
- });
- await router.load();
-};
-
export default createHandler(
() => <StartServer document={...} />,
- undefined,
- routerLoad
+ async (context) => {
+ const url = new URL(context.request.url);
+ const path = url.href.replace(url.origin, "");
+ router.update({
+ history: createMemoryHistory({ initialEntries: [path] })
+ });
+ await router.load();
+ return {};
+ }
);Approach B — Restore
|
| Date | PR / Commit | What happened | Evidence |
|---|---|---|---|
| 2025-03-03 | #1840 | Added routerLoad as 4th param to createBaseHandler (then 3rd to createHandler) specifically for TanStack router SSR support |
Patch: routerLoad param added |
| 2025-11-07 | #1942 | Full v2 rewrite of handler.ts (vinxi → h3, major restructuring). routerLoad removed entirely — no replacement API provided. |
Patch: routerLoad removed, createHandler reduced to 2 args (see handler.ts diff) |
| 2026-03-17 | #254 | "Reintegrate SolidStart v1" — copied v1's entry-server.tsx (which uses the 3-arg createHandler with routerLoad) into the v2 template without modification |
Template file |
| 2026-05-06 | solid-docs | docs team | create-handler.mdx still documents routerLoad as a valid API parameter |
| Current main | @solidjs/start main | — | All current releases ship 2-arg createHandler. The SSR bug persists. |
| 2026-07-18 | #2206 | Stream output fix (cancellation-safe `ReadableStream`). Unrelated to this issue (different layer: stream transport vs. router initialization). | N/A |
Notable: TanStack/router#3521 tracks SSR support for the Solid driver — related context but distinct from the routerLoad wiring issue.
|
Thanks! |
|
@Tommypop2 @brenelz Since routerLoad will be supported in the next release of solid-start, you just need to decide whether to keep or remove with-tanstack-router from the list. To cover both cases, I’ll open PRs for both options. Please feel free to merge or close them whichever way you prefer!😅 |
Purpose
This PR cleans up the v2 templates list to align with the solidjs/templates repository.
Context
The template list is currently hardcoded in
constants.ts.but templates are fetched from the
solidjs/templatesrepo.This mismatch can cause issues when templates are added/removed in the templates repo but not reflected here.
Ref: solidjs/templates
Changes
hackernews,notes, v1with-solidbase)Before/After
hackernewsnoteswith-solidbase(v1 version)Sorted order:
with-auth→with-authjs→with-drizzle→with-mdx→with-prisma→with-solid-styled→with-solidbase→with-strict-csp→with-tailwindcss→
with-tanstack-router→with-trpc→with-unocss→with-vitestFiles Changed
packages/create/src/utils/constants.tsAppendix: Future Automation Ideas
To keep the template list in sync with
solidjs/templates, we could consider:solidjs/templatesrepo changesconstants.tswhen v2 templates are added/removedBoth approaches would eliminate manual maintenance and prevent sync issues. Thoughts?
p.s. Thank you for your efforts and for maintaining this project.